

import { game } from "../../../../script/game/control/game";
import { actionType, assetsType, cardType, hospitalType, schoolType } from "../../../../script/game/gameType";
import { ListItem } from "../../../../script/util/ListView/ListItem";
import { ccs } from "../../../../script/util/services";
import { touchExd } from "../../../../script/util/TouchExtend";

const {ccclass, property} = cc._decorator;

@ccclass
export default class NewClass extends ListItem<hospitalType> {
    
    //标题
    @property(cc.Label)
    title: cc.Label = null;

    //描述
    @property(cc.Label)
    desc: cc.Label = null;

    //影响
    @property(cc.Label)
    effect: cc.Label = null;

    //花费
    @property(cc.Label)
    price: cc.Label = null;

    //
    @property(cc.RichText)
    score: cc.RichText = null;

    @property(cc.Label)
    power: cc.Label = null;

    @property(cc.Node)
    icon: cc.Node = null;

    @property(cc.Node)
    pass: cc.Node = null;

    start () {

    }
    initItem(data: hospitalType, index: number) {
        ccs.spriteExd.setSprite(this.icon, ccs.resMgr.getHospitalIcon(data.level));
        this.title.string = data.name;
        this.desc.string = data.desc;
        this.price.string = "花费倍数：" + ccs.gf.getOmitNum(data.money);
        this.effect.string = `治愈率：${data.percent * 100}%`;
        this.power.string = "精力：" + data.power;
    }
    onItemclick(data: hospitalType) {
        if(game.playerMgr.heroInfo.power < data.power) {
            ccs.winMgr.showWin("toast", {msg: "精力不足"});
            return 
        }
        // 去治什么病
        ccs.winMgr.showWin("chooseIllWin", {id: data.id});
    }
   
}
